import { Card, Input, Button } from 'antd';
export default function Filter(props) {
  const { listParams, dispatch } = props;
  return (
    <Card>
      <Input
        style={{ width: 240 }}
        value={listParams.searchText}
        onChange={(e) => {
          dispatch({
            type: 'goods/updateStateProps',
            payload: {
              name: 'listParams',
              value: {
                searchText: e.target.value,
              },
            },
          });
        }}
      />
      <Button
        type="primary"
        style={{ marginLeft: 20 }}
        onClick={() => {
          dispatch({
            type: 'goods/updateStateProps',
            payload: {
              name: 'listParams',
              value: {
                page: 1,
              },
            },
          });
          dispatch({
            type: 'goods/getList',
          });
        }}
      >
        搜索
      </Button>
      <Button
        style={{ marginLeft: 20 }}
        onClick={() => {
          dispatch({
            type: 'goods/reset',
          });
        }}
      >
        重置
      </Button>
    </Card>
  );
}
